package langresources;

import java.util.ResourceBundle;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;


@ManagedBean
@SessionScoped
public class ResourcesController {
    
    private static ResourceBundle resourceBundle;
    private static String  resourceBundlePath = "/langresources/resources";
    
    public ResourcesController(){
        changeLanguage("RUS");
    }
    
    public static void changeLanguage(String newLanguage){
        resourceBundle = ResourceBundle.getBundle(resourceBundlePath+newLanguage);
    }
    
    public static String extractResource(String resourceName){
        return resourceBundle.getString(resourceName);
    }
    
}
